package nuig.prolog.PrologAccess.impl;

import java.io.FileInputStream;

import alice.tuprolog.InvalidTheoryException;
import alice.tuprolog.Prolog;
import alice.tuprolog.SolveInfo;
import alice.tuprolog.Theory;

public class test {
	public static void main(String[] args) throws Exception {
		Prolog engine=new Prolog();
		Theory theory = new Theory(new FileInputStream("test.pl"));
		try {
		        engine.setTheory(theory);
		        SolveInfo info = engine.solve("room(X).");
                System.out.println(info.isSuccess());
                while(info.isSuccess()&&engine.hasOpenAlternatives())
                {
                	info=engine.solveNext();//get next solution
                	System.out.println(info.getSolution());
                	info.getTerm("X");
                	//System.out.println(info.toString());
                	//System.out.println(info.getSolution());
                }
                
		} catch(InvalidTheoryException ex){
		}
	}
}
